// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
//
// Copyright (c) KALEIDOS INC

@use "refactor/common-refactor.scss" as deprecated;

// PROGRESS WIDGET
.export-progress-widget {
  @include deprecated.flexCenter;
  width: deprecated.$s-28;
  height: deprecated.$s-28;
}

// PROGRESS MODAL
.export-progress-modal {
  --export-modal-bg-color: var(--alert-background-color-default);
  --export-modal-fg-color: var(--alert-text-foreground-color-default);
  --export-modal-icon-color: var(--alert-icon-foreground-color-default);
  --export-modal-border-color: var(--alert-border-color-default);
  position: absolute;
  right: deprecated.$s-16;
  top: deprecated.$s-48;
  display: grid;
  grid-template-columns: deprecated.$s-24 1fr deprecated.$s-24;
  grid-template-areas:
    "icon text close"
    "bar bar bar";
  gap: deprecated.$s-4 deprecated.$s-8;
  padding-block-start: deprecated.$s-8;
  background-color: var(--export-modal-bg-color);
  border: deprecated.$s-1 solid var(--export-modal-border-color);
  border-radius: deprecated.$br-8;
  z-index: deprecated.$z-index-modal;
  overflow: hidden;
}

.has-error {
  --export-modal-bg-color: var(--alert-background-color-error);
  --export-modal-fg-color: var(--alert-text-foreground-color-error);
  --export-modal-icon-color: var(--alert-icon-foreground-color-error);
  --export-modal-border-color: var(--alert-border-color-error);
  grid-template-areas: "icon text close";
  gap: deprecated.$s-8;
  padding-block: deprecated.$s-8;
}

.icon {
  @extend .button-icon;
  grid-area: icon;
  align-self: center;
  margin-inline-start: deprecated.$s-8;
  stroke: var(--export-modal-icon-color);
}

.export-progress-title {
  @include deprecated.bodyMediumTypography;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: deprecated.$s-8;
  grid-area: text;
  align-self: center;
  padding: 0;
  margin: 0;
  color: var(--export-modal-fg-color);
}

.progress {
  @include deprecated.bodyMediumTypography;
  padding-left: deprecated.$s-8;
  margin: 0;
  align-self: center;
  color: var(--modal-text-foreground-color);
}

.retry-btn {
  @include deprecated.buttonStyle;
  @include deprecated.bodySmallTypography;
  display: inline;
  text-align: left;
  color: var(--modal-link-foreground-color);
  margin: 0;
  padding: 0;
}

.progress-close-button {
  @include deprecated.buttonStyle;
  padding: 0;
  margin-inline-end: deprecated.$s-8;
}

.close-icon {
  @extend .button-icon;
  stroke: var(--export-modal-icon-color);
}

.progress-bar {
  margin-top: 0;
  grid-area: bar;
}

// EXPORT MODAL
.modal-overlay {
  @extend .modal-overlay-base;
  &.transparent {
    background-color: transparent;
  }
}

.modal-container {
  @extend .modal-container-base;
  max-height: calc(10 * deprecated.$s-80);
}

.modal-header {
  margin-bottom: deprecated.$s-24;
}

.modal-title {
  @include deprecated.headlineMediumTypography;
  color: var(--modal-title-foreground-color);
}

.modal-close-btn {
  @extend .modal-close-btn-base;
}

.modal-content,
.no-selection {
  @include deprecated.bodySmallTypography;
  margin-bottom: deprecated.$s-24;
  .modal-link {
    @include deprecated.bodyLargeTypography;
    text-decoration: none;
    cursor: pointer;
    color: var(--modal-link-foreground-color);
  }
  .selection-header {
    @include deprecated.flexRow;
    height: deprecated.$s-32;
    margin-bottom: deprecated.$s-4;
    .selection-btn {
      @include deprecated.buttonStyle;
      @extend .input-checkbox;
      @include deprecated.flexCenter;
      height: deprecated.$s-24;
      width: deprecated.$s-24;
      padding: 0;
      margin-left: deprecated.$s-16;
      span {
        @extend .checkbox-icon;
      }
    }
    .selection-title {
      @include deprecated.bodyLargeTypography;
      color: var(--modal-text-foreground-color);
    }
  }
  .selection-wrapper {
    position: relative;
    width: 100%;
    height: fit-content;
  }
  .selection-shadow {
    width: 100%;
    height: 100%;
    &:after {
      position: absolute;
      bottom: 0;
      left: 0;
      width: 100%;
      height: 50px;
      background: linear-gradient(to top, rgba(24, 24, 26, 1) 0%, rgba(24, 24, 26, 0) 100%);
      content: "";
      pointer-events: none;
    }
  }
  .selection-list {
    @include deprecated.flexColumn;
    max-height: deprecated.$s-400;
    overflow-y: auto;
    padding-bottom: deprecated.$s-12;
    .selection-row {
      @include deprecated.flexRow;
      background-color: var(--entry-background-color);
      min-height: deprecated.$s-40;
      border-radius: deprecated.$br-8;
      .selection-btn {
        @include deprecated.buttonStyle;
        display: grid;
        grid-template-columns: min-content auto 1fr auto auto;
        align-items: center;
        width: 100%;
        height: 10%;
        gap: deprecated.$s-8;
        padding: 0 deprecated.$s-16;
        .checkbox-wrapper {
          @extend .input-checkbox;
          @include deprecated.flexCenter;
          height: deprecated.$s-24;
          width: deprecated.$s-24;
          padding: 0;
          .checkobox-tick {
            @extend .checkbox-icon;
          }
        }
        .selection-name {
          @include deprecated.bodyLargeTypography;
          @include deprecated.textEllipsis;
          flex-grow: 1;
          color: var(--modal-text-foreground-color);
          text-align: start;
        }
        .selection-scale {
          @include deprecated.bodyLargeTypography;
          @include deprecated.textEllipsis;
          min-width: deprecated.$s-108;
          padding: deprecated.$s-12;
          color: var(--modal-text-foreground-color);
        }
        .selection-extension {
          @include deprecated.bodyLargeTypography;
          @include deprecated.textEllipsis;
          min-width: deprecated.$s-72;
          padding: deprecated.$s-12;
          color: var(--modal-text-foreground-color);
        }
      }
      .image-wrapper {
        @include deprecated.flexCenter;
        min-height: deprecated.$s-32;
        min-width: deprecated.$s-32;
        background-color: var(--app-white);
        border-radius: deprecated.$br-6;
        margin: auto 0;
        img,
        svg {
          object-fit: contain;
          max-height: deprecated.$s-40;
        }
      }
    }
  }
}

.action-buttons {
  @extend .modal-action-btns;
}
.cancel-button {
  @extend .modal-cancel-btn;
}
.accept-btn {
  @extend .modal-accept-btn;
  &.danger {
    @extend .modal-danger-btn;
  }
}

.modal-scd-msg,
.modal-subtitle,
.modal-msg {
  @include deprecated.bodyLargeTypography;
  color: var(--modal-text-foreground-color);
}

.export-option {
  @extend .input-checkbox;
  width: 100%;
  align-items: flex-start;
  label {
    align-items: flex-start;
    .modal-subtitle {
      @include deprecated.bodyLargeTypography;
      color: var(--modal-title-foreground-color);
    }
  }
  span {
    margin-top: deprecated.$s-8;
  }
}

.option-content {
  @include deprecated.flexColumn;
  @include deprecated.bodyLargeTypography;
}

.file-entry {
  .file-name {
    @include deprecated.flexRow;
    .file-icon {
      @include deprecated.flexCenter;
      height: deprecated.$s-16;
      width: deprecated.$s-16;

      svg {
        @extend .button-icon-small;
        stroke: var(--input-foreground);
      }
    }
    .file-name-label {
      @include deprecated.bodyLargeTypography;
      @include deprecated.textEllipsis;
    }
  }
  &.loading {
    .file-name {
      color: var(--modal-text-foreground-color);
    }
  }
  &.error {
    .file-name {
      color: var(--modal-text-foreground-color);
      .file-icon svg {
        stroke: var(--modal-text-foreground-color);
      }
    }
  }
  &.success {
    .file-name {
      color: var(--modal-text-foreground-color);
      .file-icon svg {
        stroke: var(--modal-text-foreground-color);
      }
    }
  }
}
